<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>问答</title>
    <link rel="stylesheet" type="text/css" href="__CSS__api.css"/>
    <link rel="stylesheet" type="text/css" href="__CSS__aui.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__dropload.css" />

    <style>
        body {
            margin-top: 0.525rem;
        }
        .list_content {
            background-color: #ffffff;
            width: 100%;
            height: auto;
            padding: 0.75rem;
            padding-bottom: 0.375rem;
            margin-bottom: 0.5rem;
        }
        .person_inf {
            width: 100%;
            height: 2rem;
            margin-bottom: 0.675rem;
        }
        .per_img {
            width: 2rem;
            height: 2rem;
            border-radius: 50%;
            overflow: hidden;
            margin-right: 0.5rem;
        }
        .per_img img {
            width: 100%;
            height: 100%;
        }
        .name_show {
            height: 2rem;
        }
        .name {
            width: 10rem;
            height: 1rem;
            line-height: 1.3rem;
            font-size: 0.75rem;
            color: #333333;
            font-weight: medium;
        }
        .time {
            width: 100%;
            height: 1rem;
            line-height: 1.5rem;
            font-size: 0.7rem;
            color: #999999;
        }
        .tit_top {
            width: 100%;
            color: #4D4D4D;
            font-size: 0.75rem;
            line-height: 1.05rem;
            font-weight: bold;
            margin-bottom: 0.5rem;
        }
        .tit_content {
            width: 100%;
            color: #808080;
            font-size: 0.7rem;
            line-height: 1rem;
            height: auto;
            margin-bottom: 0.75rem;
        }
        .talk {
            margin: auto;
            width: 2.5rem;
            padding: 0 0.525rem;
        }
        .talk img {
            width: 0.85rem;
            height: 0.85rem;
        }
        .talk_num {
            font-size: 13px;
            line-height: 0.85rem;
            color: #cccccc;
            width: auto;
            margin-left: 0.25rem;
        }
        .out_talk {
            width: 100%;
            padding-top: 0.5rem;
        }
        .photoAll {
            width: 100%;
            margin-bottom: 0.5rem;
        }
        .photo {
            display: inline-block;
            position: relative;
        }
        .photo:nth-child(3n+2) {
            margin-right: 12.5px;
            margin-left: 12.5px;
        }
        .photo img {
            width: 100%;
            height: 100%;
        }
        .talk1 {
            width: 5rem;
        }
    </style>
    <style>
        body{
            background-color: #fff;
        }
        .aui-bar-nav .aui-iconfont {
            position: relative;
            font-family: "aui_iconfont" !important;
            font-size: 0.75rem;
            color: #E73C5C;
            font-style: normal;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            height: 2.4rem;
        }

        .aui-icon-tu{
            height: 2.4rem;
            width: 49px;
            background: url('__IMG__left.png') no-repeat 0.5rem center;
            background-size: 22px 22px;
        }
        .aui-bar-nav .aui-title{
            font-size: 0.9rem;
            color: #333333;
            font-weight: 500;
        }
        .aui-icon-rightu{
            height: 2.4rem;
            width: 49px;
            /*background: url('__IMG__search.png') no-repeat 0.6rem center;*/
            background-size: 22px 22px;
        }
        .aui-tab-item.aui-active {
            color: #E73C5C;
            font-size: 17px;
            position: relative;
            border-bottom: none !important;
        }

        .aui-tab-item {
            height: 2.03rem;
            /*line-height: 2.03rem;*/
            color: #333333;
            font-weight: medium;
            font-size: 17px;
        }
        .sss {
            width: 100%;
            padding: 0 25%;
        }
        .aui-bar-nav {
            background-color: #ffffff;
        }

    </style>
</head>
<body>
<header class="aui-bar aui-bar-nav underLine" style="padding-top:25px;"id="header">
    <a class="aui-pull-left" tapmode="active" onclick="api.closeWin()"> <span class="aui-iconfont aui-icon-tu"> </span> </a>

    <div class="aui-title">
        <div class="aui-tab bar">
            <div class=" sss aui-tab bar nav " id="tab" onclick="tab_qh(this)">
                <div class="aui-tab-item  aaa">
                    热门
                </div>
                <div class="aui-tab-item aui-active bbb" >
                    最新
                </div>
            </div>
        </div>
    </div>

    <a class="aui-pull-right" >
        <span class="aui-iconfont aui-icon-rightu" tapmode="active" onclick="right()">提问</span>
    </a>
</header>
<div>
<div class="upOrDown">
    <div class="upOrDown_data">
        {volist name="list" id="vo"}
        <div class="list_content" onclick="xq()" tapmode>
            <div class="person_inf flex-wrap">
                <div class="per_img">
                    <img src="{$vo.user_image}" alt="">
                </div>
                <div class="name_show flex-con">
                    <div class="name aui-ellipsis-1">
                        {$vo.user_username}
                    </div>
                    <div class="time">
                        {$vo.interlocution_time}
                    </div>
                </div>
            </div>
            <div class="tit_top aui-ellipsis-2">
                {$vo.interlocution_title}
            </div>
            <div class="tit_content ">
                {$vo.interlocution_introduce}
            </div>
            <div class="photoAll">
                {volist name="vo['img']" id="vv"}
                <div class="photo" tapmode>
                    <img  src="{$vv}" />
                </div>
                {/volist}
            </div>
            <div class="out_talk topLine">
                <div class="talk flex-wrap ">
                    <div class='flex-con'>
                        <img src="__IMG__talk@3x.png"  alt="">
                    </div>
                    <div class="talk_num">{$vo.interlocution_num}</div>
                </div>
            </div>
        </div>
        {/volist}
    </div>
</div>
</div>
</body>
<script type="text/javascript" src="__JS__jquery.min.js"></script>
<script type="text/javascript" src="__JS__dropload.min.js"></script>
<script type="text/javascript" src="__JS__api.js"></script>
<script type="text/javascript" src="__JS__aui-lazyload.js"></script>

<script type="text/javascript">
    window.onload = function() {
        size();//图片宽高

        $api.addEvt($api.byId('text1'),'input',function(){

            var searchValue = $api.val($api.byId("text1")) || "";

            if(searchValue.length>=200){
                $api.byId('num1').innerHTML=200;
                $api.byId('num2').innerHTML=0;

                $api.val($api.byId("text1"),searchValue.slice(0,200));

            }else{
                $api.byId('num1').innerHTML=searchValue.length;
                $api.byId('num2').innerHTML=200-searchValue.length;
            }

        });
    }
    //图片宽高
    function size(){
        var pic=$api.domAll(".photo");
        for(var i=0;i<pic.length;i++){
            $api.css(pic[i],'width:'+(document.body.offsetWidth-68)/3+'px'+';height:'+(document.body.offsetWidth-68)/3+'px');
        }
    }

    //右边点击事件
    function right() {
        alert("点击");
    }

    //问答详情
    function xq() {
        location.href='{:url("first/answerdetail")}';
    }
    function tab_qh() {
        location.href='{:url("first/answer")}';

    }
</script>

<script>
    var page = 1;
    /**
     * 上拉加载，下拉刷新
     */
    var dropload = $('.upOrDown').dropload({
        scrollArea : window,
        autoLoad : true,
//        domUp : {
//            domClass   : 'dropload-up',
//            domRefresh : '<div class="dropload-refresh">↓下拉刷新-自定义内容</div>',
//            domUpdate  : '<div class="dropload-update">↑释放更新-自定义内容</div>',
//            domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中-自定义内容...</div>'
//        },
//        domDown : {
//            domClass   : 'dropload-down',
//            domRefresh : '<div class="dropload-refresh">刷新</div>',
//            domLoad    : '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
//            domNoData  : '<div class="dropload-noData">无数据</div>'
//        },
        loadDownFn : function(me){
            page++;

            $.ajax({
                url:'{:url("First/ajaxanswernew")}',
                data:'page='+page,//
                type:'POST',
                dataType:'JSON',
                success: function(data){
                    var arrLen = data.msg.length;
                    if(arrLen<=0){

                        me.lock();
//                         无数据
                        me.noData(true);
                        // 每次数据加载完，必须重置
                        me.resetload();
                    }else{
                        var datas = data.msg;
                        $.each(datas,function(key,v){
                            var _html='';

                            _html +='<div class="list_content" tapmode>';
                            _html +='<div class="person_inf flex-wrap"> ' +
                                    '       <div class="per_img"> ' +
                                    '<img src="'+v.user_image+'" alt=""> ' +
                                    '</div> ' +
                                    '<div class="name_show flex-con"> ' +
                                    '   <div class="name aui-ellipsis-1">'+v.user_username  + '</div>';
                            _html +='<div class="time">' + v.interlocution_time +
                                    '</div> </div></div> ' +
                                    '<div class="tit_top aui-ellipsis-2">'+v.interlocution_title+'</div>';
                            _html +='<div class="tit_content ">'+v.interlocution_introduce +'</div>';
                            $.each(v.img,function (kk,vv) {
                                _html +='<div class="photoAll"><div class="photo" tapmode> <img  src="'+vv+'" /> </div> </div>';
                            })

                            _html +='<div class="out_talk topLine"> <div class="talk flex-wrap "> ' +
                                    '<div class="flex-con"> ' +
                                    '<img src="__IMG__talk@3x.png"  alt=""> ' +
                                    '</div> <div class="talk_num">'+ v.interlocution_num+ '</div>' +
                                    '</div> </div> </div>';
                            $(".upOrDown_data").append(_html);
                        });

//                        $('.upOrDown_data').append(data);
                        // 每次数据加载完，必须重置
                        me.resetload();
                    }
//                    $('.cooc').click(function () {
//                        var id = $(this).attr('id');
//                        location.href = '{:url("Mechanism/mechanismDetail")}?id='+id;
//                    });
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    // 即使加载出错，也得重置
                    me.resetload();
                }
            });
        },
        loadUpFn : function(me){
            page = 1;
            $.ajax({
                url:'{:url("First/ajaxanswernew")}',
                data:'page='+page,
                type:'POST',
                dataType:'json',
                success: function(data){
                    $('.upOrDown_data').empty();//
                    var datas = data.msg;
                    $.each(datas,function(key,v){
                        var _html='';
                        _html +='<div class="list_content" tapmode>';
                        _html +='<div class="person_inf flex-wrap"> ' +
                                '       <div class="per_img"> ' +
                                '<img src="'+v.user_image+'" alt=""> ' +
                                '</div> ' +
                                '<div class="name_show flex-con"> ' +
                                '   <div class="name aui-ellipsis-1">'+v.user_username  + '</div>';
                        _html +='<div class="time">' + v.interlocution_time +
                                '</div> </div></div> ' +
                                '<div class="tit_top aui-ellipsis-2">'+v.interlocution_title+'</div>';
                        _html +='<div class="tit_content ">'+v.interlocution_introduce +'</div>';
                        $.each(v.img,function (kk,vv) {
                            _html +='<div class="photoAll"><div class="photo" tapmode> <img  src="'+vv+'" /> </div> </div>';
                        })

                        _html +='<div class="out_talk topLine"> <div class="talk flex-wrap "> ' +
                                '<div class="flex-con"> ' +
                                '<img src="__IMG__talk@3x.png"  alt=""> ' +
                                '</div> <div class="talk_num">'+ v.interlocution_num+ '</div>' +
                                '</div> </div> </div>';
                        $(".upOrDown_data").append(_html);

                    });
                    me.resetload();
                    me.unlock();
                    me.noData(false);
//                    $('.cooc').click(function () {
//                        var id = $(this).attr('id');
//                        location.href = '{:url("Mechanism/mechanismDetail")}?id='+id;
//                    });
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    me.resetload();
                }
            });
        }
    });
</script>
</html>
